Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: After coming back from result detail, search result come back to the top, not current position #1150 #1183

Merged
merged 1 commit into from
Mar 24, 2019

Conversation

anhanh11001
Copy link
Contributor

@anhanh11001 anhanh11001 commented Feb 25, 2019

Details:
After coming from EventDetailsFragment, the SearchResultFragment doesn't retain the old position. Adding id for NestedScrollView will make Android automatically retain the current position

Fixes: #1150

.setPopExitAnim(R.anim.slide_out_right)
.setPopUpTo(R.id.eventsFragment, true)
.build()
Navigation.findNavController(rootView).navigate(R.id.eventsFragment, bundle, navOptions)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a good solution. It was better earlier. Can you please find another way for it? Reset looks good.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@liveHarshit I have updated a better solution. haha, I was stupid before, this is actually a much simpler issue.

Details:
After coming from EventDetailsFragment, the SearchResultFragment doesn't retain the old position. Adding id for NestedScrollView will make Android automatically retain the current position

Fixes: #1150
@@ -29,6 +29,7 @@
</LinearLayout>

<androidx.core.widget.NestedScrollView
android:id="@+id/searchResultsNestedScrollView"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please explain, how defining an id solve the issue?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@liveHarshit Well, in short, this is Android View State Storing Mechanism (to retain an amount of information/state if we provide it an id). So for instance, if you're having an EditText and some text in it, I believe the text is also retained after screen rotation if we provide it with an id.

So this is also the way current EventsFragment restoring its position after coming back from EventDetailsFragment.

@iamareebjamal iamareebjamal merged commit 9ce1a90 into fossasia:development Mar 24, 2019
@anhanh11001 anhanh11001 deleted the 1150_issue_search_result branch June 20, 2019 13:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants